#ifndef THEPROGRAMMERHASALRASDYINCLUDMAINH
#define THEPROGRAMMERHASALRASDYINCLUDMAINH

// Needed to declare this stupidity
#include <curl/curl.h>

#define NEWTORRENT_HEALTHBAR 4
#define HP_NORMAL -1
#define HP_NEEDSAVING -2
#define HP_DEAD -3 // Use to tell which elements are not needed from the array anymore because they've been freed.

#define WEBSITEPREFIX "https://api.bitport.io"

typedef struct{
	char* filename;
	char* token;
	char* timeLeft;
	signed int healthBar; // For the meaning of the values, see HP_<something> constants. If this value is more than 0, it represents the number of updates left that it is acceptable for this torrent not to be found in the status list. 
	double progress;
}singleStatus;

typedef struct{
	//gtk_list_box_row_new
	//GtkWidget* internalWidget;
	char* filename;
	char* filecode;
	char isFolder;
}fileInfo;

void _deleteAStatusSp(singleStatus* _passedStatus, char _doFree);
fileInfo* addFileInfo();
char* addTorrentLink(CURL* _passedCurl, const char* _passedTorrentURL, char* _passedToken);
void changeMallocString(char** _passedMallocString, char* _newString);
void deleteAStatus(singleStatus* _passedStatus);
void dumpLogFile(char* _string);
char* getAccessToken(CURL* _passedCurl, const char* _passedCode);
char* getActiveTransfersJSON(CURL* _passedCurl, char* _passedToken);
singleStatus* increaseTorrentArray();
int main(int argc, char *argv[]);
void prepareAPIHeader(char* _passedUserToken, struct curl_slist** _passedHeaders);
void printDivider();
char* readStringFile(char* _filename);
void resetFileInfos();
singleStatus* searchStatusesForToken(char* _passedToken);
void updateFileInfo(CURL* _passedCurl, char* _passedFolderCode);
void updateTorrentStatuses(CURL* _passedCurl);
long getMilliseconds();
void saveCacheAccess(char* _access);
char* getHDDL(CURL* _passedCurl, const char* _fileCode, char* _passedToken, char _isFolder);
char* getHomeDir();

#endif